<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateEmigratedsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('emigrateds', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('闯关人');
            $table->unsignedBigInteger('category_id')->unsigned()->index()->comment('分类id');
            $table->unsignedBigInteger('subject_id')->index()->comment('科目id');
            $table->integer('total')->comment('总关卡数');
            $table->integer('fraction')->default(0)->comment('我的成绩');
            $table->tinyInteger('status')->comment('闯关状态 0:未通过1:通关');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('emigrateds');
    }
}
